1. Field of the Invention
The present invention relates to an image processing apparatus, image processing method, and computer-readable medium which correct a color balance of input digital image data.
2. Description of the Related Art
Conventionally, a method of estimating a light source at the time of shooting of image data shot by a digital camera or that obtained by optically scanning a film shot by an analog camera, and applying a color balance correction to the image data has been proposed.
Japanese Patent Laid-Open No. 2002-152772 describes the following method. That is, a blackbody locus of gray and human skin color pixels based on a representative spectral distribution of a camera is held in advance. RGB components of respective pixels are multiplied by various coefficients so as to attain inverse conversions of a color balance correction of a camera, and the number of pixels after conversion, which are located adjacent to the blackbody locus, is evaluated, thereby estimating a light source at the time of shooting. After the light source is estimated, the converted image is converted into colors under a predetermined light source.
The aforementioned color balance correction method suffers the following problem. For example, when an image capturing apparatus such as a digital camera shoots an image under an incandescent lamp or in a shade under the fine weather, an image is often saved to have an improper color balance (for example, red fog or blue fog). In a related art, a light source of the shot image is estimated, and the color balance correction is executed based on the estimated light source. In this case, it is possible to correct the image saved after the improper color balance correction to a satisfactory image.
On the other hand, for example, assuming that an image of yellow flowers is shot in a macro mode, the most part of the shot image is occupied by a yellow region. In the related art, a light source of the shot image is similarly estimated for such image, and the color balance correction is executed based on the estimated light source. In this case, since the most part of the image is occupied by the yellow region, it is more likely to estimate that the image was shot under a light source having a low color temperature such as an incandescent lamp and suffers color fog.
As another example, assuming that an image of blue sky is shot, the most part of the shot image is occupied by a blue region. In the related art, a light source of the shot image is similarly estimated for such image, and the color balance correction is executed based on the estimated light source. In this case, since the most part of the image is occupied by the blue region, it is more likely to estimate that the image was shot under a light source having a high color temperature such as a fluorescent lamp that illuminates an object palely, and suffers color fog.
Therefore, in the related art, the color balance correction is applied to an image which originally has a proper color balance while erroneously estimating a light source. In this case, since it is determined that an image suffers color fog, a serious image adverse effect, that is, whitish correction of the yellow flowers or blue sky, is caused.
That is, the color balance correction has to be applied to an image which is shot under the incandescent lamp or in the shade under the fine weather since that image suffers color fog and has an improper color balance state. On the other hand, the color balance correction is to be suppressed for an image which is obtained by shooting the image of the yellow flowers in the macro mode or shooting only that of the blue sky, since that image is a proper image. Therefore, conflicting problems are posed. Against these problems, an effective solution has not been proposed yet.